package com.xidian.GMS.service.impl;

import java.math.BigDecimal;

import java.util.List;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import com.xidian.GMS.dto.Page;
import com.xidian.GMS.entity.EmploymentConsult;

import com.xidian.GMS.entity.RecruitmentInformation;
import com.xidian.GMS.entity.RelevantEnterprisesWebsite;
import com.xidian.GMS.mapper.RecruitmentInformationMapper;
import com.xidian.GMS.mapper.RelevantEnterprisesWebsiteMapper;
import com.xidian.GMS.service.RecruitmentInformationService;
@Service
public class RecruitmentInformationServiceImpl implements RecruitmentInformationService {
	@Autowired
	private RecruitmentInformationMapper recruitmentInformationMapper;
	@Override
	public RecruitmentInformation Insert(RecruitmentInformation recruitmentInformation) {
		   System.out.println("3333333333");
		   
	   	  int rows = recruitmentInformationMapper.insert(recruitmentInformation);
	      System.out.println("222222222");
			if( recruitmentInformation == null ||rows == 0){
				throw new RuntimeException("错误");
			}
	          return recruitmentInformation;
	    }


	@Override
	public boolean delete(int enterpriseid) {
	      int x =  recruitmentInformationMapper.deleteByPrimaryKey(enterpriseid);
		  	  if (x == 1) {
		  	  	  return true;
			}
		          return false;
	}

	@Override
	public boolean update(RecruitmentInformation  recruitmentInformation) {
		// TODO Auto-generated method stub
			System.out.println(recruitmentInformation);
        int temp = recruitmentInformationMapper.updateByPrimaryKeySelective(recruitmentInformation);
		
    	  if (temp >= 1) {
   	  	  return true;
 	}
           return false;
     }

	@Override
	public Page getRecruitmentInformation(int cur) {
		Page page = new Page(cur);
		
		int count = recruitmentInformationMapper.count();
		
		List<RecruitmentInformation> accounts = recruitmentInformationMapper.findAll(page.getOffset(), page.getSize());
		
		page.setCount(count);
		page.setList(accounts);
		
		return page;
	}

	}


